class Solution:
    # @param s, a string
    # @return an integer
    def titleToNumber(self, s):
    	code_A = ord('A')
    	ans = 0
    	for c in s:
    		ans = ans * 26 + ord(c) - code_A + 1
    	return ans

if __name__ == '__main__':
	so = Solution()
	print so.titleToNumber('BB')
